package cn.iocoder.yudao.module.wine.api;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.wine.api.dto.GuaranteeRecordDTO;
import cn.iocoder.yudao.module.wine.dal.dataobject.guaranteerecord.GuaranteeRecordDO;
import cn.iocoder.yudao.module.wine.dal.mysql.guaranteerecord.GuaranteeRecordMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * @author zyc
 * @createDate 2024/7/29 16:50
 */

@Service
@Validated
public class GuaranteeRecordApiImpl implements GuaranteeRecordApi{
    @Resource
    private GuaranteeRecordMapper guaranteeRecordMapper;
    @Override
    public Boolean addGuaranteeRecord(GuaranteeRecordDTO dto) {
        GuaranteeRecordDO bean = BeanUtils.toBean(dto, GuaranteeRecordDO.class);
        return guaranteeRecordMapper.insert(bean) > 0;

    }

    @Override
    public void editguaranteeRecord(GuaranteeRecordDTO guaranteeRecordByNo) {
        GuaranteeRecordDO bean = BeanUtils.toBean(guaranteeRecordByNo, GuaranteeRecordDO.class);
        guaranteeRecordMapper.updateById(bean);
    }
}
